﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Text.RegularExpressions;
using System.Collections;
using System.IO;

namespace SCOSub
{
    public partial class ASSanalysis : Form
    {
        public ASSanalysis()
        {
            InitializeComponent();
            this.TopMost = Const.DoTopMost;

        }
        public delegate void SetMainFormTopMostHandle(bool topmost);
        public event SetMainFormTopMostHandle SetMainFormTopMost;//设置MainForm的TopMost
        private enum OpenFile { DA, DB };
        private OpenFile ChangeDialogue;

        private void OpenFileDialogue(object sender, EventArgs e)
        {
            if (((Button)sender).Name == "DAbutton")
                ChangeDialogue = OpenFile.DA;
            else ChangeDialogue = OpenFile.DB;
            openFileDialog1.ShowDialog();
        }

        private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
        {
            if (ChangeDialogue == OpenFile.DA)
                textBox1.Text = openFileDialog1.FileName;
            else textBox2.Text = openFileDialog1.FileName;
        }

        private void ASSanalysis_FormClosing(object sender, FormClosingEventArgs e)
        {
            SetMainFormTopMost(true);
        }
        private void Analysis(string Filename)
        {
            string ASSDoc = ReadFile(Filename);
            string filename = Path.GetFileName(Filename);
            dataGridView.Columns.Add("_index", "编号");
            dataGridView.Columns.Add("_starttime", "开始时间");
            dataGridView.Columns.Add("_endtime", "结束时间");
            dataGridView.Columns.Add("_text", "文本");
            dataGridView.Columns.Add("_error", "存在问题");
            Application.DoEvents();

            Regex r = new Regex(@"Dialogue: ([0-9]+),([0-9]):([0-9]{2}):([0-9]{2}).([0-9]{2}),([0-9]):([0-9]{2}):([0-9]{2}).([0-9]{2}),([^,]+),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^\n]*)", RegexOptions.IgnoreCase);
            MatchCollection m = r.Matches(ASSDoc);
            int oldrows = dataGridView.Rows.Count - 1;
            dataGridView.Rows.AddCopies(oldrows, m.Count);
            ASSData[] ad = new ASSData[m.Count];
            StringBuilder sberr;



            for (int i = 0; i < m.Count; i++)
            {
                ad[i] = new ASSData(m[i]);
                dataGridView.Rows[i + oldrows].Cells[0].Value = oldrows + i + 1;
                dataGridView.Rows[i + oldrows].Cells[1].Value = ad[i].FormattedStarttime;//FormatTime(ad[i].StartTime_Hour, ad[i].StartTime_Minute, ad[i].StartTime_Second, ad[i].StartTime_MilliSecond);
                dataGridView.Rows[i + oldrows].Cells[2].Value = ad[i].FormattedEndtime;//FormatTime(ad[i].EndTime_Hour, ad[i].EndTime_Minute, ad[i].EndTime_Second, ad[i].EndTime_MilliSecond);
                dataGridView.Rows[i + oldrows].Cells[3].Value = ad[i].Text;
            }
            for (int i = 0; i < m.Count; i++)
            {
                sberr = new StringBuilder();
                if (timescheckBox.Checked == true && ad[i].StartTime_MilliSecondFormat - ad[i].EndTime_MilliSecondFormat >= 0)
                    sberr.Append("时间轴错误;");
                if (timeshortcheckBox.Checked == true && ad[i].EndTime_MilliSecondFormat - ad[i].StartTime_MilliSecondFormat < (int)mintime_numericUpDown1.Value * 10)
                    sberr.Append("时间轴过短;");
                if (longcheckBox.Checked == true && ad[i].Text.Length > (int)maxlen_numericUpDown1.Value)
                    sberr.Append("文本太长;");
                if (m.Count <= 1)
                    continue;
                for (int p = i + 1; p < m.Count; p++)
                {
                    if (Math.Max(ad[i].EndTime_MilliSecondFormat, ad[p].EndTime_MilliSecondFormat) - Math.Min(ad[i].StartTime_MilliSecondFormat, ad[p].StartTime_MilliSecondFormat) < ad[i].Lengthms + ad[p].Lengthms)
                        sberr.Append(string.Format("与{0}行发生重叠", p + oldrows + 1));
                }
                string s = sberr.ToString().Trim();
                if (s.Length != 0)
                    dataGridView.Rows[i + oldrows].Cells[4].Style.BackColor = Color.Red;
                dataGridView.Rows[i + oldrows].Cells[4].Value = s;
            }
            dataGridView.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridView.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridView.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridView.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridView.Columns[3].Width = 350;
            dataGridView.Columns[0].Frozen = true;
            dataGridView.Columns[0].DefaultCellStyle.BackColor = Color.LightYellow;
            dataGridView.Columns[1].DefaultCellStyle.BackColor = Color.LightSkyBlue;
            dataGridView.Columns[2].DefaultCellStyle.BackColor = Color.LightSkyBlue;
            dataGridView.Columns[3].DefaultCellStyle.BackColor = Color.LightSkyBlue;



            dataGridView.Refresh();
        }
        /*private void Analysis2(string Filename)
        {
            string ASSDoc = ReadFile(Filename);
            string filename = Path.GetFileName(Filename);

            dataGridView.Columns.Add("_index", "编号");
            dataGridView.Columns.Add("_starttime", "开始时间");
            dataGridView.Columns.Add("_endtime", "结束时间");
            dataGridView.Columns.Add("_text", "文本");
            dataGridView.Columns.Add("_error", "存在问题");

            Regex r = new Regex(@"Dialogue: ([0-9]+),([0-9]):([0-9]{2}):([0-9]{2}).([0-9]{2}),([0-9]):([0-9]{2}):([0-9]{2}).([0-9]{2}),([^,]+),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^\n]*)", RegexOptions.IgnoreCase);
            MatchCollection m = r.Matches(ASSDoc);
            DataTable dt = new DataTable();
            int oldrows = dataGridView.Rows.Count - 1;
            dataGridView.Rows.AddCopies(oldrows, m.Count);
            ASSData[] ad = new ASSData[m.Count];
            StringBuilder sberr;
            DataRow dr = null;
            dt.Columns.Add("_index");
            dt.Columns.Add("_starttime");
            dt.Columns.Add("_endtime");
            dt.Columns.Add("_text");
            dt.Columns.Add("_error");
            

            
            for (int i = 0; i < m.Count; i++)
            {
                ad[i] = new ASSData(m[i]);
                dr = dt.NewRow();

                dr.ItemArray[0] = i + 1;
                dr.ItemArray[1] = ad[i].FormattedStarttime;//FormatTime(ad[i].StartTime_Hour, ad[i].StartTime_Minute, ad[i].StartTime_Second, ad[i].StartTime_MilliSecond);
                dr.ItemArray[2] = ad[i].FormattedEndtime;//FormatTime(ad[i].EndTime_Hour, ad[i].EndTime_Minute, ad[i].EndTime_Second, ad[i].EndTime_MilliSecond);
                dr.ItemArray[3] = ad[i].Text;


            }
            for (int i = 0; i < m.Count; i++)
            {
                sberr = new StringBuilder();
                if (timescheckBox.Checked == true && ad[i].StartTime_MilliSecondFormat - ad[i].EndTime_MilliSecondFormat >= 0)
                    sberr.Append("时间轴错误;");
                if (timeshortcheckBox.Checked == true && ad[i].EndTime_MilliSecondFormat - ad[i].StartTime_MilliSecondFormat < (int)mintime_numericUpDown1.Value * 10)
                    sberr.Append("时间轴过短;");
                if (longcheckBox.Checked == true && ad[i].Text.Length > (int)maxlen_numericUpDown1.Value)
                    sberr.Append("文本太长;");
                if (m.Count <= 1)
                    continue;
                for (int p = i + 1; p < m.Count; p++)
                {
                    if (Math.Max(ad[i].EndTime_MilliSecondFormat, ad[p].EndTime_MilliSecondFormat) - Math.Min(ad[i].StartTime_MilliSecondFormat, ad[p].StartTime_MilliSecondFormat) < ad[i].Lengthms + ad[p].Lengthms)
                        sberr.Append(string.Format("与{0}行发生重叠", p + 1));
                }
                string s = sberr.ToString().Trim();
                if (s.Length != 0)
                    dataGridView.Rows[i].Cells[4].Style.BackColor = Color.Red;
                dr.ItemArray[4] = s;
            }
            dataGridView.DataSource = dt;
            dataGridView.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridView.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridView.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridView.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridView.Columns[3].Width = 350;
            dataGridView.Columns[0].Frozen = true;
            dataGridView.Columns[0].DefaultCellStyle.BackColor = Color.LightYellow;
            dataGridView.Columns[1].DefaultCellStyle.BackColor = Color.LightSkyBlue;
            dataGridView.Columns[2].DefaultCellStyle.BackColor = Color.LightSkyBlue;
            dataGridView.Columns[3].DefaultCellStyle.BackColor = Color.LightSkyBlue;



            dataGridView.Refresh();
        }
        */
        private void AnalysisDouble(string ASSDocPath, string ASSDoc2Path)
        {
            string ASSDoc = ReadFile(ASSDocPath);
            string ASSDoc2 = ReadFile(ASSDoc2Path);
            string filename1 = Path.GetFileName(ASSDocPath);
            string filename2 = Path.GetFileName(ASSDoc2Path);
            dataGridView.Columns.Add("_index", "编号");
            dataGridView.Columns.Add("_starttime1", filename1 + "开始时间");
            dataGridView.Columns.Add("_endtime1", filename1 + "结束时间");
            dataGridView.Columns.Add("_text1", filename1 + "文本");
            dataGridView.Columns.Add("_error1", filename1 + "存在问题");
            dataGridView.Columns.Add("_starttime2", filename2 + "开始时间");
            dataGridView.Columns.Add("_endtime2", filename2 + "结束时间");
            dataGridView.Columns.Add("_text2", filename2 + "文本");
            dataGridView.Columns.Add("_error2", filename2 + "存在问题");


            Application.DoEvents();
            Regex r = new Regex(@"Dialogue: ([0-9]+),([0-9]):([0-9]{2}):([0-9]{2}).([0-9]{2}),([0-9]):([0-9]{2}):([0-9]{2}).([0-9]{2}),([^,]+),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^\n]*)", RegexOptions.IgnoreCase);
            MatchCollection m1 = r.Matches(ASSDoc);
            MatchCollection m2 = r.Matches(ASSDoc2);

            int oldrows = dataGridView.Rows.Count - 1;
            ASSData[] ad1 = new ASSData[m1.Count];
            ASSData[] ad2 = new ASSData[m2.Count];
            StringBuilder sberr;
            DialogResult dr = DialogResult.Yes;
            int count1 = m1.Count;
            int count2 = m2.Count;
            dataGridView.Rows.AddCopies(oldrows, Math.Max(count1, count2));

            for (int i = 0; i < count1; i++)
            {
                ad1[i] = new ASSData(m1[i]);
                dataGridView.Rows[i + oldrows].Cells[1].Value = ad1[i].FormattedStarttime;//FormatTime(ad1[i].StartTime_Hour, ad1[i].StartTime_Minute, ad1[i].StartTime_Second, ad1[i].StartTime_MilliSecond);
                dataGridView.Rows[i + oldrows].Cells[2].Value = ad1[i].FormattedEndtime;//FormatTime(ad1[i].EndTime_Hour, ad1[i].EndTime_Minute, ad1[i].EndTime_Second, ad1[i].EndTime_MilliSecond);
                dataGridView.Rows[i + oldrows].Cells[3].Value = ad1[i].Text;

            }
            for (int i = 0; i < count1; i++)
            {
                sberr = new StringBuilder();
                if (timescheckBox.Checked == true && ad1[i].StartTime_MilliSecondFormat - ad1[i].EndTime_MilliSecondFormat >= 0)
                    sberr.Append("时间轴错误;");
                if (timeshortcheckBox.Checked == true && ad1[i].EndTime_MilliSecondFormat - ad1[i].StartTime_MilliSecondFormat < (int)mintime_numericUpDown1.Value * 10)
                    sberr.Append("时间轴过短;");
                if (longcheckBox.Checked == true && ad1[i].Text.Length > (int)maxlen_numericUpDown1.Value)
                    sberr.Append("文本太长;");
                if (count1 <= 1)
                    continue;
                for (int p = i + 1; p < count1; p++)
                {
                    if (Math.Max(ad1[i].EndTime_MilliSecondFormat, ad1[p].EndTime_MilliSecondFormat) - Math.Min(ad1[i].StartTime_MilliSecondFormat, ad1[p].StartTime_MilliSecondFormat) < ad1[i].Lengthms + ad1[p].Lengthms)
                        sberr.Append(string.Format("与{0}行发生重叠;", p + oldrows + 1));
                }
                string s = sberr.ToString();
                if (s.Length != 0)
                    dataGridView.Rows[i + oldrows].Cells[4].Style.BackColor = Color.Red;
                dataGridView.Rows[i + oldrows].Cells[4].Value = s;
                dataGridView.Rows[i + oldrows].Cells[1].Style.BackColor = Color.LightSkyBlue;
                dataGridView.Rows[i + oldrows].Cells[2].Style.BackColor = Color.LightSkyBlue;
                dataGridView.Rows[i + oldrows].Cells[3].Style.BackColor = Color.LightSkyBlue;

            }
            for (int i = 0; i < count2; i++)
            {
                ad2[i] = new ASSData(m2[i]);
                dataGridView.Rows[i + oldrows].Cells[5].Value = ad2[i].FormattedStarttime;//FormatTime(ad2[i].StartTime_Hour, ad2[i].StartTime_Minute, ad2[i].StartTime_Second, ad2[i].StartTime_MilliSecond);
                dataGridView.Rows[i + oldrows].Cells[6].Value = ad2[i].FormattedEndtime;//FormatTime(ad2[i].EndTime_Hour, ad2[i].EndTime_Minute, ad2[i].EndTime_Second, ad2[i].EndTime_MilliSecond);
                dataGridView.Rows[i + oldrows].Cells[7].Value = ad2[i].Text;
            }
            for (int i = 0; i < count2; i++)
            {
                sberr = new StringBuilder();
                if (timescheckBox.Checked == true && ad2[i].StartTime_MilliSecondFormat - ad2[i].EndTime_MilliSecondFormat >= 0)
                    sberr.Append("时间轴错误;");
                if (timeshortcheckBox.Checked == true && ad2[i].EndTime_MilliSecondFormat - ad2[i].StartTime_MilliSecondFormat < (int)mintime_numericUpDown1.Value * 10)
                    sberr.Append("时间轴过短;");
                if (longcheckBox.Checked == true && ad2[i].Text.Length > (int)maxlen_numericUpDown1.Value)
                    sberr.Append("文本太长;");
                if (count2 <= 1)
                    continue;
                for (int p = i + 1; p < count2; p++)
                {
                    if (Math.Max(ad2[i].EndTime_MilliSecondFormat, ad2[p].EndTime_MilliSecondFormat) - Math.Min(ad2[i].StartTime_MilliSecondFormat, ad2[p].StartTime_MilliSecondFormat) < ad2[i].Lengthms + ad2[p].Lengthms)
                        sberr.Append(string.Format("与{0}行发生重叠;", p + oldrows + 1));
                }
                string s = sberr.ToString();
                if (s.Length != 0)
                    dataGridView.Rows[i + oldrows].Cells[8].Style.BackColor = Color.Red;
                dataGridView.Rows[i + oldrows].Cells[8].Value = s;

                dataGridView.Rows[i + oldrows].Cells[5].Style.BackColor = Color.LightSteelBlue;
                dataGridView.Rows[i + oldrows].Cells[6].Style.BackColor = Color.LightSteelBlue;
                dataGridView.Rows[i + oldrows].Cells[7].Style.BackColor = Color.LightSteelBlue;

            }
            for (int i = 0; i < Math.Max(count1, count2); i++)
            {
                dataGridView.Rows[i].Cells[0].Value = i + 1 + oldrows;
            }



            if (count1 == count2)
            {
                dataGridView.Columns.Add("_between", "文件之间");
                twofilecompare(ad1, ad2, oldrows);
            }
            else
            {
                dr = MessageBox.Show("行数不同，将忽略多余的行，是否比较？", "询问", MessageBoxButtons.YesNo);
                if (dr == DialogResult.Yes)
                {
                    dataGridView.Columns.Add("_between", "文件之间");
                    twofilecompare(ad1, ad2, oldrows);
                }
            }
            dataGridView.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridView.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridView.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridView.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridView.Columns[5].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridView.Columns[6].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridView.Columns[8].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            if (dr == DialogResult.Yes)
                dataGridView.Columns[9].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridView.Columns[0].Frozen = true;
            dataGridView.Columns[3].Width = 300;
            dataGridView.Columns[7].Width = 300;
            dataGridView.Columns[0].DefaultCellStyle.BackColor = Color.LightYellow;

            dataGridView.Refresh();


        }
        private void twofilecompare(ASSData[] ad1, ASSData[] ad2, int oldrows)
        {
            int count1 = ad1.GetLength(0);
            int count2 = ad2.GetLength(0);
            StringBuilder sberr;
            for (int i = 0; i < Math.Min(count1, count2); i++)
            {
                sberr = new StringBuilder();
                if (charnumber_checkBox.Checked == true && ad1[i].Text.Length != ad2[i].Text.Length)
                    sberr.Append("字符数不一致;");
                if (sametext_checkBox2.Checked == true && ad1[i].Text != ad2[i].Text)
                    sberr.Append("文本不一致;");
                if (sametime_checkBox.Checked == true)
                {
                    if (ad1[i].StartTime_MilliSecondFormat != ad2[i].StartTime_MilliSecondFormat)
                        sberr.Append("开始时间不一致;");
                    if (ad1[i].EndTime_MilliSecondFormat != ad2[i].EndTime_MilliSecondFormat)
                        sberr.Append("结束时间不一致;");
                }
                string s = sberr.ToString();
                if (s.Length != 0)
                    dataGridView.Rows[i + oldrows].Cells[9].Style.BackColor = Color.Red;
                dataGridView.Rows[i + oldrows].Cells[9].Value = s;
            }
        }

        private void clean()
        {
            dataGridView.Rows.Clear();
            for (int i = dataGridView.Columns.Count - 1; i >= 0; i--)
                dataGridView.Columns.RemoveAt(i);
        }
        private void ASSanalysis_Load(object sender, EventArgs e)
        {


        }

        private void analyses_button_Click(object sender, EventArgs e)
        {
            string f1 = textBox1.Text.Trim();
            string f2 = textBox2.Text.Trim();
            clean();

            if (twofile_checkBox.Checked == false)
            {
                if (f1.Length == 0)
                {
                    MessageBox.Show("没有打开文件");
                    return;
                }
                if (isExist(f1) == false)
                {
                    MessageBox.Show("文件不存在");
                    return;
                }
                Analysis(f1);

            }
            else
            {
                if (f1.Length == 0 || f2.Length == 0)
                {
                    MessageBox.Show("没有打开文件");
                    return;
                }
                if (isExist(f1) == false || isExist(f2) == false)
                {
                    MessageBox.Show("文件不存在");
                    return;
                }
                AnalysisDouble(f1, f2);
            }

        }
        private string ReadFile(string path)
        {
            StreamReader sr = new StreamReader(path, Encoding.Unicode);
            string s = sr.ReadToEnd();
            sr.Close();
            return s;
        }
        private bool isExist(string path)
        {
            FileInfo fi = new FileInfo(path);
            return fi.Exists;
        }
        private void cleanall_button_Click(object sender, EventArgs e)
        {
            textBox1.Text = "";
            textBox2.Text = "";
        }

        private void twofile_checkBox_CheckedChanged(object sender, EventArgs e)
        {
            if (twofile_checkBox.Checked)
            {
                textBox2.Visible = true;
                DBbutton.Visible = true;
                charnumber_checkBox.Visible = true;
                sametext_checkBox2.Visible = true;
                sametime_checkBox.Visible = true;
            }
            else
            {
                textBox2.Visible = false;
                DBbutton.Visible = false;
                charnumber_checkBox.Visible = false;
                sametext_checkBox2.Visible = false;
                sametime_checkBox.Visible = false;
            }
        }



    }
    public struct ASSData
    {
        public int StartTime_Hour;
        public int StartTime_Minute;
        public int StartTime_Second;
        public int StartTime_MilliSecond;//10ms
        public int EndTime_Hour;
        public int EndTime_Minute;
        public int EndTime_Second;
        public int EndTime_MilliSecond;//10ms
        public string Text;

        public ASSData(Match m)
        {
            StartTime_Hour = int.Parse(m.Groups[2].Captures[0].Value);
            StartTime_Minute = int.Parse(m.Groups[3].Captures[0].Value);
            StartTime_Second = int.Parse(m.Groups[4].Captures[0].Value);
            StartTime_MilliSecond = int.Parse(m.Groups[5].Captures[0].Value);
            EndTime_Hour = int.Parse(m.Groups[6].Captures[0].Value);
            EndTime_Minute = int.Parse(m.Groups[7].Captures[0].Value);
            EndTime_Second = int.Parse(m.Groups[8].Captures[0].Value);
            EndTime_MilliSecond = int.Parse(m.Groups[9].Captures[0].Value);
            this.Text = m.Groups[16].Captures[0].Value;
        }
        public int StartTime_MilliSecondFormat
        {
            get
            {
                return StartTime_Hour * 3600 * 1000 + StartTime_Minute * 60 * 1000 + StartTime_Second * 1000 + StartTime_MilliSecond * 10;
            }
            set
            {
                StartTime_Hour = (int)(value / 3600 / 1000);
                StartTime_Minute = (int)((value - StartTime_Hour * 3600 * 1000) / 60 / 1000);
                StartTime_Second = (int)((value - StartTime_Hour * 3600 * 1000 - StartTime_Minute * 60 * 1000) / 1000);
                StartTime_MilliSecond = (int)(value % 1000 / 10);
            }
        }
        public int EndTime_MilliSecondFormat
        {
            get
            {
                return EndTime_Hour * 3600 * 1000 + EndTime_Minute * 60 * 1000 + EndTime_Second * 1000 + EndTime_MilliSecond * 10;
            }
            set
            {
                EndTime_Hour = (int)(value / 3600 / 1000);
                EndTime_Minute = (int)((value - EndTime_Hour * 3600 * 1000) / 60 / 1000);
                EndTime_Second = (int)((value - EndTime_Hour * 3600 * 1000 - EndTime_Minute * 60 * 1000) / 1000);
                EndTime_MilliSecond = (int)(value % 1000 / 10);
            }
        }
        public int Lengthms
        {
            get
            {
                return EndTime_MilliSecondFormat - StartTime_MilliSecondFormat;
            }
        }
        public string FormattedStarttime
        {
            get
            {
                return string.Format(@"{0:D1}:{1:D2}:{2:D2}.{3:D2}", StartTime_Hour, StartTime_Minute, StartTime_Second, StartTime_MilliSecond);
            }
        }
        public string FormattedEndtime
        {
            get
            {
                return string.Format(@"{0:D1}:{1:D2}:{2:D2}.{3:D2}", EndTime_Hour, EndTime_Minute, EndTime_Second, EndTime_MilliSecond);
            }
        }
    }
}
